package com.itWaiLong.Mapper;

import com.itWaiLong.Dao.personal_project;
import com.itWaiLong.Dao.project_share;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShareProjectMapper {

    /**
     * 用户分享自己的项目
     * @return
     */
    int share(project_share projectShare);

    /**
     * 查找项目
     * @param projectId
     * @return
     */
    @Select("select * from campus_programming.project_share where project_id = #{projectId}")
    personal_project selectProjectById(int projectId);

    /**
     * 用户浏览分享页
     * @return
     */
    @Select("select * from campus_programming.project_share")
    List<project_share> browse();

    /**
     * 删除分享的项目
     * @param projectId
     * @return
     */
    @Delete("delete from campus_programming.project_share where project_id = #{projectId}")
    int delete(int projectId);
}
